import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/actReProcdef',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/actReProcdef/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/actReProcdef',
    method: 'put',
    data
  })
}

/**
 * 查看流程图
 * @param {*} id
 * @returns
 */
export function viewImage(id) {
  return request({
    url: '/api/activiti/viewImage/' + id,
    method: 'get',
    responseType: 'blob'
  })
}

/**
 * 查看流程图踪迹
 * @param {*} id
 * @returns
 */
export function viewProcessTrace(id) {
  return request({
    url: '/api/activiti/viewProcessTrace/' + id,
    method: 'get',
    responseType: 'blob'
  })
}

/**
 * 启动流程
 * @param {*} id
 * @returns
 */
export function apply(data) {
  console.log(data)
  return request({
    url: '/api/activiti/apply',
    method: 'post',
    data
  })
}

export default { add, edit, del, viewImage, apply, viewProcessTrace }
